<template>
  <el-dialog :title="title" :close-on-click-modal="false" :fullscreen="true" :visible.sync="visible"
    :before-close="cancel" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="50%">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
        
        <el-col :span="8">
            <el-form-item label="所属学院">
              <el-select v-model="dataForm.FHOME" placeholder="请选择" disabled>
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="8">
            <el-form-item label="学年届" class="required" prop="FYEAR" >
              <el-input
                v-model="dataForm.FYEAR"
                placeholder="请输入"
                clearable
                :disabled="!insertorupdate"
                maxlength="8"
                :style="{ width: '100%' }"
                disabled
              >
              </el-input>
            </el-form-item>
          </el-col>

         <el-col :span="8">
            <el-form-item label="所属年级">
              <el-select v-model="dataForm.FPARENTNO" placeholder="请选择" disabled>
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="8">
            <el-form-item label="所属班级">
              <el-select v-model="dataForm.FCLASS" placeholder="请选择" disabled>
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="8">
          <el-form-item label="学籍号码" prop="FUSERNUMBER" >
            <el-input v-model="dataForm.FUSERNUMBER"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="学生姓名" prop="FUSER" >
            <el-input v-model="dataForm.FUSER"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="有效起日" prop="FBEGDATE" >
            <el-date-picker v-model="dataForm.FBEGDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>

        </el-form-item>

        </el-col>

        <el-col :span="8">
          <el-form-item label="有效讫日" prop="FENDDATE" >
            <el-date-picker v-model="dataForm.FENDDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="开通状态">
              <el-select v-model="dataForm.FNOTE" placeholder="请选择" >
                <el-option
                  v-for="item in options4"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="5">
          <el-form-item label="">
            <!-- <el-button type="success" icon="el-icon-plus" @click="insert">添加场地</el-button> -->
            <el-button type="primary" :loading="loading" @click="closePage">返回</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>

    <el-table :data="list" border stripe>
      <!-- <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
      </el-table-column> -->
      <el-table-column prop="FENTRYID" label="序号" ></el-table-column>
      <el-table-column prop="FGRAND" label="所属教学楼" ></el-table-column>
      <el-table-column prop="FLEVEL" label="所属楼层"></el-table-column>
      <el-table-column prop="FPOINT" label="场地名称" ></el-table-column>
    </el-table>
    <!-- <div class="addbox">
         <el-link icon="el-icon-plus" type="primary" >添加一行</el-link>
    </div> -->

    <StudqueryFcuston ref="StudqueryFcuston" @confirm="shoplist" />
  </el-dialog>
</template>
<script>
  import StudqueryFcuston from "@/components/StudqueryFcuston/StudqueryFcuston.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    components: { StudqueryFcuston },
    props: {
      formationlist: {
        type: Array,
        default: [],
      },
    },
    data() {
      return {
        title: "查看详情",
        insertorupdate: true,
        dataForm: {
          FHOME:"化学与材料科学学院",
          FYEAR :"2024",
          FPARENTNO:"大一",
          FCLASS:"化学系1班",
          FUSERNUMBER:"241001",
          FUSER: "曹操",
          FNOTE: "已开通",
          FBEGDATE: "2024-12-01",
          FENDDATE: "2025-11-30"
        },
        rules: {
        },
        list: [{  "FENTRYID":1,
                  "FGRAND": "综合实验楼",
                  "FLEVEL": "一楼",
                  "FPOINT": "奉综教楼201"
                },
                { "FENTRYID":2,
                  "FGRAND": "综合实验楼",
                  "FLEVEL": "一楼",
                  "FPOINT": "奉综教楼202"
                }],
        loading: false,
        visible: false,

        options1: [{
          value: '1',
          label: '化学与材料科学学院'
        }, {
          value: '2',
          label: '生命科学学院'
        }],

        //所属校区选择数据
        options2: [{
          value: 'L001',
          label: '大一'
        }, {
          value: 'L002',
          label: '大二'
        }, {
          value: 'L003',
          label: '大三'
        }, {
          value: 'L004',
          label: '大四'
        }],

        //所属校区选择数据
        options3: [{
          value: 'L001',
          label: '化学系1班'
        }, {
          value: 'L002',
          label: '化学系2班'
        }],

        options4: [{
          value: 'L001',
          label: '未开通'
        }, {
          value: 'L002',
          label: '已开通'
        }],
        
      };
    },
    created() {
    },
    mounted() { },
    methods: {
      closePage(){
        console.log('关闭弹窗dialog');
        this.visible = false;
      },
      init(FBILLNO) {
        this.dataForm.FBILLNO = FBILLNO;
        if (this.dataForm.FBILLNO) {
          this.title = "修改"
          this.insertorupdate = false;
        }
        else {
          this.title = "查看"
          this.dataForm.FBILLNO = "K" + Math.floor(Math.random() * 10000000) + 1;
          this.insertorupdate = true;
        }
        this.visible = true;
      },
      insert() {
        this.$refs.StudqueryFcuston.open();
      },
      shoplist(data) {
        data.forEach(item => {
          this.list.push({
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "1"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "曹操"
          },{
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "2"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "刘备"
          })
        });
      },
      //
      cancel() {
        this.$refs.elForm.resetFields();
        this.list = [];
        this.visible = false;
      },
    },
  };
</script>